package com.devshephard.springcloud.service;


import com.devshephard.springcloud.service.impl.PaymentFallbackServiceImpl;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
@FeignClient(value = "CLOUD-PROVIDER-HYSTRIX-PAYMENT",fallback =  PaymentFallbackServiceImpl.class) //这里可以通过一个实现类来对接口中的服务进行降级后的fallback
public interface PaymentService {

    @GetMapping("/payment/hystrix/ok/{id}")
    public String paymentInfo_OK(@PathVariable("id") Integer id);

    @GetMapping("/payment/hystrix/timeout/{id}")
    public String paymentInfo_TimeOut(@PathVariable("id") Integer id);

    @GetMapping("/payment/hystrixCommond/timeout/{id}")
    public String paymentInfoHystrixCommond_TimeOut(@PathVariable("id") Integer id);

    @GetMapping("/payment/hystrixCommond/error/{id}")
    public String paymentInfoHystrixCommond_Error(@PathVariable("id") Integer id);
}
